<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>dom ready </title>
    <script>
        /**
        执行顺序:    
            写在dom最后被执行的
            interactive
            DOMContentLoaded 
            complete
            图片加载完成
            window.onload
        **/
        
        document.addEventListener( "DOMContentLoaded", function(){
            console.log('DOMContentLoaded');   
        },false);
        
        
        document.onreadystatechange = function(){
            console.log(document.readyState);
        };
        window.onload = function(){
            console.log('window.onload');
        };
    </script>
</head>
<body>
    <img src="http://pic.4j4j.cn/upload/pic/20130306/5943d885a6.jpg?t=5" alt="超高清壁纸" onload = "(function(){
        console.log('图片加载完成');
    })()">
    <script>
        console.log('写在dom最后被执行的');
    </script>    
</body>

</html>